package com.djx.provider.controller;

import com.djx.comm.controller.BaseController;
import com.djx.provider.feign.RedisClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 调用redis feign
 * @author dingjunxiong
 */
@RestController
@RequestMapping("redis")
public class RedisController extends BaseController {
    @Autowired
    RedisClientService redisClientService;

    @RequestMapping("/set")
    public Object set(String key, String value, int seconds) {
        redisClientService.set(key, value, seconds);
        return successObject("添加成功");
    }

    @RequestMapping("/get")
    public Object get(String key) {
        return successObject(redisClientService.get(key));
    }
}
